<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
 <link href="<%=basePath %>admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="<%=basePath %>admin/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="<%=basePath %>admin/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="<%=basePath %>admin/css/style.css" rel="stylesheet">
    <link href="<%=basePath %>admin/css/style-responsive.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>
<jsp:include page="top.jsp"></jsp:include>
  <section id="container" class="">
      <!--header start-->
      
      <!--sidebar end-->
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
              <!-- page start-->
              
             
              <div class="row">
                  <div class="col-lg-12">
                      <section class="panel">
                          <header class="panel-heading">
                              奖品列表
                          </header>
                          <table class="table table-striped table-advance table-hover">
                              <thead>
                              <tr>
                                  <th><i class="icon-bullhorn"></i> 序号</th>
                                  <th class="hidden-phone"><i class="icon-question-sign"></i> 奖品</th>
                                  <th><i class="icon-bookmark"></i> 抽奖几率% </th>
                                  <th></th>
                                  <th> 操作</th>
                              </tr>
                              </thead>
                              <tbody id="giftList">
                              
                              
                             
                              </tbody>
                          </table>
                      </section>
                  </div>
              </div>
              <!-- page end-->
          </section>
      </section>
      <!--main content end-->
  </section>

</body>
</html>
<script>
$(document).ready(function(){
	showAll();
});
	function showAll(){
		debugger;
		
		var l = document.getElementById("giftList");
		var everything =document.getElementById("everything").value;
		l.innerHTML='';
		$.ajax( {
						url:'<%=basePath%>prize/findAll',
						type:'post',
						data: {
							
						},
						datatype : "json",//"xml", "html", "script", "json", "jsonp", "text".           
						success : function(data) {
							var json=eval('(' + data + ')');
							$.each(json, function (n, item) {
								if(item.name.indexOf(everything)>=0){
									addGift(n,item);
								}
								
							});
						},
						error : function() {
			                alert("异常！！！");
			                selAllFriend();	
			            }
				});
	}
	function addGift(n,item){
		var val = "<tr>"+
            "<td>"+(n+1)+"</td>"+
            "<td class=\"hidden-phone\">"+item.name+"</td>"+
            "<td>"+item.probability+"</td>"+
            "<td></td>"+
            "<td>"+
               "<a href=\"../../prize/findOneById?id="+item.id+"\" class=\"btn btn-primary btn-xs\"><i class=\"icon-pencil\"></i></a>"+
            "</td>"+
        "</tr>";

		$("#giftList").append(val);
	}
	
	
</script>